package xcmg.device.dao.mapper.warehouse;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import xcmg.device.dao.entity.warehouse.WarehouseDeliveryRecordDO;
import xcmg.device.service.vo.boxup.BoxupMaterialsQuery;
import xcmg.device.service.vo.warehouse.WarehouseDeliveryRecordVO;

import java.util.List;

@Mapper
public interface WarehouseDeliveryRecordMapper {
    int deleteByPrimaryKey(String id);

    int insert(WarehouseDeliveryRecordDO record);

    WarehouseDeliveryRecordDO selectByPrimaryKey(String id);

    int updateByPrimaryKey(WarehouseDeliveryRecordDO record);

    int deleteByDeliveryOrder(@Param("deliveryOrder") String deliveryOrder, @Param("orgId") String orgId);

    List<WarehouseDeliveryRecordDO> list(WarehouseDeliveryRecordVO model);

    int removeByOutOrderList(@Param("orderList") List<String> orderList, @Param("orgId") String orgId);

    int remove(@Param("ids") List<String> ids);

    List<WarehouseDeliveryRecordDO> findByBarcode(@Param("barCode") String barCode, @Param("orgId") String orgId);

    List<WarehouseDeliveryRecordDO> findByBarcodeByDelivery(@Param("barCode") String barCode, @Param("orgId") String orgId,@Param("deliveryReceiptNo")String deliveryReceiptNo);

    int findCountForExportAll(WarehouseDeliveryRecordVO model);

    List<WarehouseDeliveryRecordDO> findByIds(@Param("ids") List<String> ids);

    List<WarehouseDeliveryRecordDO> findBusinessOrder(BoxupMaterialsQuery boxupMaterialsQuery);

    List<WarehouseDeliveryRecordDO> listByBusinessOrder(BoxupMaterialsQuery boxupMaterialsQuery);

    int removeByBarcodeList(@Param("barcodeList") List<String> barcodeList, @Param("orgId") String orgId);

    List<WarehouseDeliveryRecordDO> findLastRecord(@Param("barCode") String barCode, @Param("orgId") String orgId);

    void updateReceiptNoWhereNull(@Param("deliveryNoteNo") String deliveryNoteNo,@Param("deliveryBillNo") String deliveryBillNo);

    Integer findCountByBusinessOrder(@Param("businessOrder") String businessOrder,@Param("orgId") String orgId,@Param("materialsNo") String materialsNo);

    int resetReceiptNo(@Param("receiptNo") String receiptNo,@Param("businessOrder") String businessOrder);

    List<String> selectBarcodeByReceiptNo(String receiptNo);

    List<WarehouseDeliveryRecordDO> selectDeliveryRecordsByReceiptNo(@Param("barCode") String barCode, @Param("orgId") String orgId,@Param("deliveryReceiptNo")String deliveryReceiptNo);
}
